<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>求红白黑球的个数.</title>
</head>
<body>
    <script>
    var red, black, white;
    for (red = 1; red <= 25; red++) {
    black = 28 - red;
    white = 25 - red;
    if (red + white == 25 && white + black == 31 && red + black == 28) {
            document.write('红球：' + red + '个' +'<br/>');
            document.write( '黑球：' + black + '个'+'<br/>' );
            document.write( '白球：' + white + '个');
    }
}
    </script>
</body>
</html>